package com.app.controller;

import com.app.model.ExpertModel;
import com.app.model.IncubatorsArticleModel;
import com.app.model.IncubatorsModel;
import com.app.service.ExpertService;
import com.app.service.IncubatorsArticleService;
import com.app.service.IncubatorsService;
import com.app.util.Result;
import com.app.vo.ExpertVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description: 专家
 * @Author: N
 * @Date: 2022/10/29 15:26
 */
@RestController
@RequestMapping("/")
public class IncubatorsController {
    @Autowired
    IncubatorsService incubatorsService;
    @Autowired
    IncubatorsArticleService incubatorsArticleService;

    /**
     *获取孵化基地列表
     * @param request
     * @param baseId
     * @return
     */
    @GetMapping("/getIncubatorsList")
    public Result<Object> getIncubatorsList(HttpServletRequest request, Integer baseId){
        IncubatorsModel model = new IncubatorsModel();
        model.setBaseId(baseId);
        List<IncubatorsModel> list = incubatorsService.getListByModel(model);
        return Result.success(list);
    }

    /**
     * 根据ID查询孵化基地
     * @param id
     * @return
     */
    @GetMapping("/getIncubatorsById")
    public Result<Object> getIncubatorsById(Integer id){
        IncubatorsModel model = incubatorsService.getModelById(id);
        return Result.success(model);
    }
    /**
     * 根据孵化基地ID查询文章
     * @param fatherId
     * @param type
     * @return
     */
    @GetMapping("/getIncubatorsArticleByFatherId")
    public Result<Object> getIncubatorsArticleByFatherId(Integer fatherId,Integer type){
        IncubatorsArticleModel model = incubatorsArticleService.getModelByFather(fatherId,type);
        return Result.success(model);
    }
}
